package com.msw.dubbo.rest;

import com.alibaba.dubbo.config.annotation.Reference;
import com.msw.dubbo.entity.Order;
import com.msw.dubbo.service.OrderService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author mashuangwei
 * @version 1.0.0
 * @date 2022-06-08 11:21:27
 */
@RestController
@RequestMapping("/dubbo")
public class OrderController {
    @Reference
    private OrderService orderService;

    @GetMapping
    public ResponseEntity<Object> addOrder() {
        return new ResponseEntity<>(orderService.addOrder(), HttpStatus.OK);
    }

    @PutMapping
    public ResponseEntity<Object> updateOrder(@RequestBody Order order) {
        return new ResponseEntity<>(orderService.updateOrder(order), HttpStatus.OK);
    }
}
